package com.hrsoft.modules.expert.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hrsoft.modules.expert.entity.ExpertGroupSegmentEntity;
import com.hrsoft.modules.expert.service.ExpertGroupSegmentService;
import com.hrsoft.common.utils.PageUtils;
import com.hrsoft.common.utils.R;



/**
 * 评委会组和标段关联表
 *
 * @author garfield.yue
 * @email yuedefeng101@163.com
 * @date 2020-05-12 14:37:09
 */
@RestController
@RequestMapping("expert/expertgroupsegment")
public class ExpertGroupSegmentController {
    @Autowired
    private ExpertGroupSegmentService expertGroupSegmentService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("expert:expertgroupsegment:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = expertGroupSegmentService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("expert:expertgroupsegment:info")
    public R info(@PathVariable("id") Long id){
		ExpertGroupSegmentEntity expertGroupSegment = expertGroupSegmentService.getById(id);

        return R.ok().put("expertGroupSegment", expertGroupSegment);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("expert:expertgroupsegment:save")
    public R save(@RequestBody ExpertGroupSegmentEntity expertGroupSegment){
		expertGroupSegmentService.save(expertGroupSegment);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("expert:expertgroupsegment:update")
    public R update(@RequestBody ExpertGroupSegmentEntity expertGroupSegment){
		expertGroupSegmentService.updateById(expertGroupSegment);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("expert:expertgroupsegment:delete")
    public R delete(@RequestBody Long[] ids){
		expertGroupSegmentService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
